package myJs.myPkg.highcharts

import myJs.myPkg.jquery.JQuery
import myJs.myPkg.jsext._

import scala.scalajs.js
import scala.language.implicitConversions
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.annotation.JSImport.Namespace

/**
 * Created by yz on 2019/3/14
 */
object Series extends SeriesBuilder(noOpts)

class SeriesBuilder(val dict: OptMap) extends JSOptionBuilder[Series, SeriesBuilder](new SeriesBuilder(_)) {

  def `type`(v: String) = jsOpt("type", v)

  def name(v: String) = jsOpt("name", v)

  def data(v: js.Array[MapDataBuilder]) = {
    val fmtV = v.map(_.dict.toJSDictionary)
    jsOpt("data", fmtV)
  }

  def joinBy(v: String) = jsOpt("joinBy", v)

  def cursor(v: String) = jsOpt("cursor", v)

  def allowPointSelect(v: Boolean) = jsOpt("allowPointSelect", v)

  def states(v: States) = jsOpt("states", v)

  def dataLabels(v: DataLabels) = jsOpt("dataLabels", v)

  def point(v: Point) = jsOpt("point", v)

}

@js.native
trait EachSeries extends js.Object {

  def name:String=js.native

}

@js.native
trait EachSeriesEvent extends js.Object {

  def point:EachPoint=js.native

}


@js.native
trait EachPoint extends js.Object {

  def name:String=js.native

}

trait Series extends js.Object {

}

object Labels extends LabelsBuilder(noOpts)

class LabelsBuilder(val dict: OptMap) extends JSOptionBuilder[Labels, LabelsBuilder](new LabelsBuilder(_)) {

  def enabled(v: Boolean) = jsOpt("enabled", v)


}

trait Labels extends js.Object {

}

object MapData extends MapDataBuilder(noOpts)

class MapDataBuilder(val dict: OptMap) extends JSOptionBuilder[MapData, MapDataBuilder](new MapDataBuilder(_)) {

  def name(v: String) = jsOpt("name", v)

  def value(v: Int) = jsOpt("value", v)


}

trait MapData extends js.Object {

}

object States extends StatesBuilder(noOpts)

class StatesBuilder(val dict: OptMap) extends JSOptionBuilder[States, StatesBuilder](new StatesBuilder(_)) {

  def hover(v: Hover) = jsOpt("hover", v)

  def select(v: Select) = jsOpt("select", v)

}

trait States extends js.Object {

}

object Hover extends HoverBuilder(noOpts)

class HoverBuilder(val dict: OptMap) extends JSOptionBuilder[Hover, HoverBuilder](new HoverBuilder(_)) {

  def color(v: String) = jsOpt("color", v)

}

trait Hover extends js.Object {

}

object Select extends SelectBuilder(noOpts)

class SelectBuilder(val dict: OptMap) extends JSOptionBuilder[Select, SelectBuilder](new SelectBuilder(_)) {

  def color(v: String) = jsOpt("color", v)

  def borderColor(v: String) = jsOpt("borderColor", v)

  def dashStyle(v: String) = jsOpt("dashStyle", v)

}

trait Select extends js.Object {

}

object DataLabels extends DataLabelsBuilder(noOpts)

class DataLabelsBuilder(val dict: OptMap) extends JSOptionBuilder[DataLabels, DataLabelsBuilder](new DataLabelsBuilder(_)) {

  def enabled(v: Boolean) = jsOpt("enabled", v)

  def format(v: String) = jsOpt("format", v)

}

trait DataLabels extends js.Object {

}

object Point extends PointBuilder(noOpts)

class PointBuilder(val dict: OptMap) extends JSOptionBuilder[Point, PointBuilder](new PointBuilder(_)) {

  def events(v: Events) = jsOpt("events", v)

}

trait Point extends js.Object {

}

object Events extends EventsBuilder(noOpts)

class EventsBuilder(val dict: OptMap) extends JSOptionBuilder[Events, EventsBuilder](new EventsBuilder(_)) {

  def click(v: js.Function) = jsOpt("click", v)

}

trait Events extends js.Object {

}



